window.addEventListener("load", function () {
	$("header ul li").forEach(function (v) {
		v.addEventListener("mouseover", function () {
			this.className = "active";
		});
		v.addEventListener("mouseout", function () {
			this.className = "";
		});
	});
	const data = [
		{ times: 4000, price: 1200, unitPrice: "0.3000" },
		{ times: 8000, price: 2000, unitPrice: "0.2500" },
		{ times: 40000, price: 8000, unitPrice: "0.2000" },
	];
	data.forEach(function (v) {
		$(
			"#bannerCont .righttext ul"
		).innerHTML += `<li data-price=${v.price}  data-unitPrice=${v.unitPrice}>${v.times}次</li>`;
	});
	$("#bannerCont .righttext ul li")[1].classList.add("active");
	$(".righttext .five").innerHTML = `<strong>￥${
		$("#bannerCont .righttext ul li")[1].dataset.price
	}</strong><span>(约${
		$("#bannerCont .righttext ul li")[1].dataset.unitprice
	}元一次)，仅限企业实名购买</span>`;


	$("#bannerCont .righttext ul li").forEach(function (v) {
		v.addEventListener("click", function () {
			if (!v.classList.contains("default")) {
				$("#bannerCont .righttext ul li").forEach(function (itme) {
					itme.classList.remove("active");
					$(".righttext .five").innerHTML="";
				});
				v.classList.add("active");
				$(".righttext .five").innerHTML = `<strong>￥${this.dataset.price}</strong><span>(约${this.dataset.unitprice}元一次)，仅限企业实名购买</span>`;
			}
		});
	});
	$(".nvaapi-box ul li").forEach(function (v,i) { 
		v.addEventListener("click", function(){ 
			$(".nvaapi-box ul li").forEach(function (itme, index) { 
				itme.classList.remove("active");
				$(".apilt div")[index].classList.remove("on");
			});
			this.classList.add("active");
			$(".apilt div")[i].classList.add("on");
		})
	});









	//粒子效果配置
	const config = {
		selector: ".bannerbg",
		vx: 4, //点x轴速度,正为右，负为左
		vy: 4, //点y轴速度
		height: 2, //点高宽，其实为正方形，所以不宜太大
		width: 2,
		count: 100, //点个数
		color: "red", //点颜色
		stroke: "blue", //线条颜色
		dist: 6000, //点吸附距离
		e_dist: 20000, //鼠标吸附加速距离
		max_conn: 100, //点到点最大连接数
	};
	//调用
	CanvasParticle(config);
});
